<?php
$title="Trang quản trị";
require '../layout/headeradmin.inc';
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
$name="";
$pass="";
/*
if(isset($_SERVER['username'])) $name=  trim ($_SERVER['username']);
if(isset($_SERVER['password'])) $pass=trim ($_SERVER['password']);
if(get_magic_quotes_gpc())
{
    $name= trim(mysqli_real_escape_string($_POST['username']));
    $pass=trim(mysqli_real_escape_string($_POST['password']));
}
$dt=$k->getUserByName($name,$pass);

if(mysqli_stmt_num_rows($data)==1)
{
    $row=  mysqli_fetch_array($data);
    session_start();
    $_SESSION['username']=$name;
    $_SESSION['Id']=$row['Id'];
}


if(isset($_SESSION['username'])){}
*/
?>

<div id="menu-main">
    <a href="createUser.php">create new</a> 
     <a href="createUser.php">create new</a> 
      
</div>
     
    <fieldset>
        <legend><text>Danh sách người dùng</text></legend>
        <table id="user">
            <thead>
                <tr>
                    <td><input type="checkbox" name="chkall" id="chkall" /></td>
                    <td>Tên</text></td>
                    <td>Tên đăng nhập</td>
                    <td>Truy cập cuối</td>
                    <td>Hoạt động</td>
                </tr>
            </thead>
            <tbody>
                <?php
                $data= $k->getAllUser();
                $i=0;
                while ($row = mysqli_fetch_array($data))
                {
                    
                   if(($i%2)==0)
                   {
                       echo'<tr class="odd">';
                   }
                    else {
                      echo '<tr>';
                    }

                        ?>                
                        
                            <td><input type="checkbox" class="chkall" /></td>
                            <td><?php echo $row['Name']; ?></td>
                            <td><?php echo $row['UserName'];?></td>
                            <td><?php echo date('d/m/Y',  strtotime( $row['EndAccess'])); ?></td>
                            <td><input type="checkbox"</td>
                        </tr>             

                        <?php
                        $i++;
                }
                ?>
            </tbody>
            <tfoot>
                <tr>
                    <td> <p>Phân trang</p></td>
            </tr>
            </tfoot>
        </table>
        
    </fieldset>
</div>
<?php
require '../layout/footeradmin.inc';
/*}
 else {
    header("Location:index.php");
}
*/
?>